home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Sample Code / MacCalendar 1.0d5 / Src / MacCalendar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-30  |  3.9 KB  |  116 lines  |  [TEXT/KAHL]

  1. /*                                    MacCalendar.h                                    */
  2. /*
  3.  * MacCalendar.h
  4.  * Copyright © 1993-94 Apple Computer Inc. All rights reserved.
  5.  *
  6.  * Edit History:
  7.  *    1.0d0    MM    First "public" distribution.
  8.  *    1.0d1    MM    Added the setup application.
  9.  *    1.0d2    MM    Added balloon help to the setup dialog. Added a "can't
  10.  *                find preference file alert." No substantive changes.
  11.  *    1.0d3    MM    Some small fixes from the Status Bar author. Now hiliting
  12.  *                the days of the week and today's date if shown.
  13.  *    1.0d4    MM    Revised to use the current ControlStrip header file. Removed
  14.  *                references to a local copy of Icons.h as the Universal Header
  15.  *                distribution has this information. Shrunk next/last month buttons.
  16.  *                Make a copy of the intlHdl so we don't change the system info.
  17.  *    1.0d5    MM    Bug displaying October 1994 - blank first line.
  18.  *    1.0d6    MM    Redid drawing routine.
  19.  */
  20. #define kApplicationCreator    'SCAL'
  21. #define ICON_Calendar        128
  22. #define ICON_StatusBar        256
  23. #define FREF_Calendar        128
  24. #define BNDL_Calendar        128
  25. #define STRN_Info            256
  26. #define PICT_RightArrow        128
  27. #define    kIconWidth            16
  28. #define kVersionMajor        1
  29. #define kVersionMinor        0
  30. #define kVersionStage        development
  31. #define kVersionRelease        5
  32. #define kVersionIdent        "1.0d5"
  33. #define kVersionString        "1.0d5 © 1993-94 Apple Computer Inc."
  34. #define kCalendarPrefName    "MacCalendar Preferences"    /* No \p */
  35. #define kFirstIsSunday        1
  36. #define kFirstIsMonday        2
  37. #ifndef REZ
  38. #ifndef FALSE
  39. #define FALSE                0
  40. #define TRUE                1
  41. #endif
  42.  
  43. /*
  44.  * This is saved across restarts - it is set from "factory settings" if no
  45.  * preference resource is found in the Status Bar preference file, and can
  46.  * be changed by the MacCalendarSetup application.
  47.  */
  48. typedef struct SavedSettings {
  49.     OSType            signature;                    /* Our signature                    */
  50.     OSType            prefVersion;                /* Preference revision level        */                
  51.     Str255            dateString;                    /* Current date label string        */
  52.     Str255            fontName;                    /* Requested display font            */
  53.     short            fontSize;                    /* Display font size                */
  54.     short            firstDayOfWeek;                /* Sunday == 1                        */
  55. } SavedSettings, **SavedSettingsHandle;
  56.  
  57. /*
  58.  * The value of kPrefVersion has no special significance. It should be changed
  59.  * whenever the SavedSettings resource is changed, or whenever it you desire to
  60.  * redefine the SavedSettings resource (for example, during debugging).
  61.  */
  62. #define kPrefVersion        ('1004')            /* Change this to rebuild pref's    */
  63. enum {
  64.     kStringPreference = 1,
  65.     kStringHelp,
  66.     kStringFontName,
  67.     kStringFontSize,
  68.     kStringFirstDayOfWeek,
  69.     kStringDayNames
  70. };
  71.  
  72. enum {
  73.     kMsgReadingPrefResource,
  74.     kMsgWritingPrefResource,
  75.     kMsgSystemError
  76. };
  77.     
  78. /*
  79.  * These functions are defined in DrawCalendar.c. They are not specific to
  80.  * the Status Bar module interface.
  81.  */
  82. /*
  83.  * DrawCalendar draws the current calendar in the current port in the specified
  84.  * display area.
  85.  */
  86. void                        DrawCalendar(
  87.         short                    year,            /* 1904 ..                    */
  88.         short                    month,            /* January == 1                */
  89.         short                    firstDayOfWeek,    /* Sunday = 1, Monday 2        */
  90.         const unsigned char        *dayName,        /* Day of week string        */
  91.         const Rect                *displayRect,    /* Where to draw the text    */
  92.         short                    fontNumber,        /* Display font                */
  93.         short                    fontSize        /* Display font size        */
  94.     );
  95. /*
  96.  * GetCalendarDisplaySize returns the size of the calendar if it is to be drawn
  97.  * in the specified fontNumber and fontSize.
  98.  */
  99. Point                        GetCalendarDisplaySize(
  100.         short                    fontNumber,        /* Display font                */
  101.         short                    fontSize        /* Display font size        */
  102.     );
  103. /*
  104.  * GetCalendarMonthRect uses the fontNumber and fontSize to compute the size
  105.  * size of the calendar as it will be drawn. Then the function creates an
  106.  * actual display rectangle that is centered in the specified displayRect.
  107.  */
  108. void                        GetCalendarMonthRect(
  109.         short                    fontNumber,        /* Display font                */
  110.         short                    fontSize,        /* Display font size        */
  111.         const Rect                *displayRect,    /* Where to draw the text    */
  112.         Rect                    *monthRect        /* Returns drawing rect        */
  113.     );
  114. #endif /* REZ */
  115.  
  116.